package executor

import (
	"deploy-tools/config"
	"deploy-tools/remote"
	"strings"
)

// ReplaceCommand 参数替换，先替换局部的参数，再替换全局的参数
func ReplaceCommand(command string, host *remote.Client) string {
	if command == "" {
		return command
	}
	target := strings.ReplaceAll(command, "{{HOST}}", host.Host.Host)
	return config.ReplaceVars(target, false)
}
